﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Nissen_Common;
using PosHacker;

namespace Nissen_Marking.Forms
{
	public partial class FormMarkSelect : Form
	{
		private POSHacker vPOSHacker;
  
		public FormMarkSelect()
		{
			InitializeComponent();

			var currentUser = ContextManager.Instance.CurrentUser;

			this.vPOSHacker = POSHacker.GetInstance(currentUser.NissenSSO.NissenSSOCode, currentUser.NissenSSO.NissenSSOPWD);

			this.vPOSHacker.Login();
		}

		private void btnTest_Click(object sender, EventArgs e)
		{
			FormTestNames formTestNames = new FormTestNames();
			formTestNames.MainForm = this;
			formTestNames.vPOSHacker = this.vPOSHacker;

			formTestNames.Show();
			this.Hide();
		}

		private void FormMarkSelect_FormClosed(object sender, FormClosedEventArgs e)
		{
			Application.Exit();
		}

		private void FormMarkSelect_FormClosing(object sender, FormClosingEventArgs e)
		{
			UserLoginLogService userLoginLogService = new UserLoginLogService();
			userLoginLogService.SaveLogoffLog();
		}

		private void btnTestCheck_Click(object sender, EventArgs e)
		{
			var tempLink = vPOSHacker.GetInconsistentMarkActionLink();
			FormInconsistentMark formInconsistentMark = new FormInconsistentMark(tempLink);
			
			//FormPCMarking formPcMarking = new FormPCMarking(tempLink);
			formInconsistentMark.MainForm = this;
			formInconsistentMark.vPOSHacker = this.vPOSHacker;
			formInconsistentMark.Show();
			this.Hide();
		}
	}
}
